// import {dispatch} from 'redux'
import { GET_ARTICLE_LIST , GET_CHANNELS} from '../actionType'
import { getChannelsList , getArticleList , delArticleList } from '@/api/article'
export const getChannels =(data)=>{
   return async dispatch=>{
        const res = await getChannelsList()
        dispatch({
            type: GET_CHANNELS,
            payload:res.data.channels
        })
   }
}
export const getArticle =(data)=>{
   return async dispatch=>{
        const res = await getArticleList(data)
        // console.log('文章列表数据',res.data.results)
        dispatch({
            type: GET_ARTICLE_LIST,
            payload:res.data
        })
   }
}
export const delArticle =(id)=>{
   return async dispatch=>{
        await delArticleList(id)  
   }
}

